package cn.base.day06;

import java.util.Random;

public class Test02 {
    public static void main(String[] args) {
        // - 1 创建一个二维数组 长度为3  里面的一维数组长度为4，
        // 用20到50之间的随机数给数组赋值
        // - 2 求二维数组所有数据的和
        // - 3 求二维数组里每个一维数组里的数据的和
        int[][] arr1 = new int[3][4];
        Random ra = new Random();
        int sum = 0;
        for (int i = 0; i < arr1.length; i++) {
            int sum1 = 0;
            for (int j = 0; j < arr1[i].length; j++) {
                arr1[i][j] = ra.nextInt(31) + 20;
                System.out.print(arr1[i][j] + " ");
                sum += arr1[i][j];
                sum1 += arr1[i][j];
            }
            System.out.println();
            System.out.println(sum1);
        }
        System.out.println(sum);

        int[][] arr = {{123, 14, 15}, {24, 15}};
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.println(arr[i][j]);
            }
        }
    }
}
